package com.zzr.demo.redis.controller;

import com.sun.xml.internal.ws.developer.MemberSubmissionAddressing;
import com.zzr.demo.redis.service.LogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: xiaomi
 * @date: 2021/10/7
 * @description:
 */
@RestController
@RequestMapping("same/day/log")
@Api(tags = "存储日志：同一天的日志进行追加")
@Slf4j
public class SameDayLogController {

    @Autowired
    LogService logService;

    @PostMapping("/append")
    @ApiOperation("追加日志")
    public boolean append(String value) {
        logService.append(value);
        return true;

    }

    @PostMapping("/getLog/{key}")
    @ApiOperation("查看日志")
    public String getLog(@PathVariable("key") String key) {
        return logService.getLog(key);
    }

}
